from pydantic import BaseModel
from typing import Sequence, List, Optional


class RelatedItem(BaseModel):
    id: int
    status: int = 0
    name: Optional[str] = None

    class Config:
        orm_mode = True


class RelatedItems(BaseModel):
    questionnaire: Sequence[RelatedItem]
    vote: Sequence[RelatedItem]
    lottery: Sequence[RelatedItem]

    class Config:
        orm_mode = True


class A(BaseModel):
    a: str
    b: int


if __name__ == '__main__':
    a = A(a="a", b={"questionnaire":[{"id":111}],
                    "vote":[{"id":222}],
                    "lottery":[{"id":333}]}, c=222, d=123, e=123123)

